package com.lin.chapter13;

import java.util.ArrayList;
import java.util.List;

public class Thing implements Cloneable {
	private List<String> list = new ArrayList<>();

	public Thing() {
		System.out.println("构造函数被执行了。。。");
	}

	@Override
	protected Thing clone(){
		Thing thing = null;
		try{
			thing = (Thing) super.clone();
			thing.list = (List<String>) ((ArrayList) this.list).clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return thing;
	}

	public void setValue(String value){
		this.list.add(value);
	}

	public List<String> getValue(){
		return list;
	}
}
